]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Fix crash when using the magnifier
authorJoaquim Rocha <jrocha@endlessm.com>
Mon, 17 Jul 2017 10:55:20 +0000 (12:55 +0200)
committerJoaquim Rocha <jrocha@endlessm.com>
Tue, 18 Jul 2017 07:51:57 +0000 (09:51 +0200)
The first time that the session is started, it can happen that the
AT SPI hasn't been correctly initialized, and this results in a crash
when attempting to register the caret or focus listeners.

In order to avoid this, these changes check the result of initializing
the AT SPI, to allow further attempts when it has failed.

https://bugzilla.gnome.org/show_bug.cgi?id=785047

js/ui/focusCaretTracker.js

index 265fcce712f30af0bf0f631ffe5d42aa34081a95..01660e0b836427661713fdeea93fed834e922047 100644 (file)
@@ -47,30 +47,27 @@ const FocusCaretTracker = new Lang.Class({
     },
 
     _initAtspi: function() {
-        if (!this._atspiInited) {
-            Atspi.init();
+        if (!this._atspiInited && Atspi.init() == 0) {
             Atspi.set_timeout(250, 250);
             this._atspiInited = true;
         }
+
+       return this._atspiInited;
     },
 
     registerFocusListener: function() {
-        if (this._focusListenerRegistered)
+        if (!this._initAtspi() || this._focusListenerRegistered)
             return;
 
-        this._initAtspi();
-
         this._atspiListener.register(STATECHANGED + ':focused');
         this._atspiListener.register(STATECHANGED + ':selected');
         this._focusListenerRegistered = true;
     },
 
     registerCaretListener: function() {
-        if (this._caretListenerRegistered)
+        if (!this._initAtspi() || this._caretListenerRegistered)
             return;
 
-        this._initAtspi();
-
         this._atspiListener.register(CARETMOVED);
         this._caretListenerRegistered = true;
     },